import redis

def connect_redis(db):
    try:
        # r = redis.Redis(host='r-2zed2mpeqshup0fiaq.redis.rds.aliyuncs.com', db=db, password='hqMsezH3ZDPkFuC8',
        #                 port=6379, decode_responses=True)
        r = redis.Redis(host='r-2zed2mpeqshup0fiaqpd.redis.rds.aliyuncs.com', db=db, password='hqMsezH3ZDPkFuC8',
                        port=6379, decode_responses=True)
        return r
    except:
        return 500